import Vue from 'vue';
import Router from 'vue-router';

Vue.use(Router);

export default new Router({
    routes: [
        {
            path: '/',
            redirect: '/dashboard'
        },
        {
            path: '/',
            component: () => import(/* webpackChunkName: "home" */ '../components/common/Home.vue'),
            meta: { title: '自述文件' },
            children: [
                {
                    path: '/dashboard',
                    component: () => import(/* webpackChunkName: "dashboard" */ '../components/page/Dashboard.vue'),
                    meta: { title: '系统首页' }
                },
                {
                    path: '/index',
                    component: () => import(/* webpackChunkName: "dashboard" */ '../components/page/Index.vue'),
                    meta: { title: '图书检索' }
                },
                {
                    path: '/mycollect',
                    component: () => import(/* webpackChunkName: "403" */ '../components/page/MyCollect.vue'),
                    meta: { title: '我的收藏' }
                },
                {
                    path: '/borrow',
                    component: () => import(/* webpackChunkName: "403" */ '../components/page/Borrow.vue'),
                    meta: { title: '借阅书籍' }
                },
                {
                    path: '/myborrow',
                    component: () => import(/* webpackChunkName: "403" */ '../components/page/MyBorrowTable.vue'),
                    meta: { title: '我的借阅信息' }
                },
                {
                    path: '/icon',
                    component: () => import(/* webpackChunkName: "icon" */ '../components/page/Icon.vue'),
                    meta: { title: '自定义图标' }
                },
                {
                    path: '/authortable',
                    component: () => import(/* webpackChunkName: "table" */ '../components/page/AuthorTable.vue'),
                    meta: { title: '作者信息管理' }
                },
                {
                    path: '/booktable',
                    component: () => import(/* webpackChunkName: "table" */ '../components/page/BookTable.vue'),
                    meta: { title: '图书信息管理' }
                },
                {
                    path: '/typetable',
                    component: () => import(/* webpackChunkName: "table" */ '../components/page/TypeTable.vue'),
                    meta: { title: '分类信息管理' }
                },
                {
                    path: '/tabs',
                    component: () => import(/* webpackChunkName: "tabs" */ '../components/page/Tabs.vue'),
                    meta: { title: '我的消息' }
                },
                {
                    path: '/addbook',
                    component: () => import(/* webpackChunkName: "form" */ '../components/page/AddBook.vue'),
                    meta: { title: '添加书籍' }
                },
                {
                    path: '/addauthor',
                    component: () => import(/* webpackChunkName: "form" */ '../components/page/AddAuthor.vue'),
                    meta: { title: '添加作者' }
                },
                {
                    // 富文本编辑器组件
                    path: '/editor',
                    component: () => import(/* webpackChunkName: "editor" */ '../components/page/VueEditor.vue'),
                    meta: { title: '富文本编辑器' }
                },
                {
                    // markdown组件
                    path: '/markdown',
                    component: () => import(/* webpackChunkName: "markdown" */ '../components/page/Markdown.vue'),
                    meta: { title: 'markdown编辑器' }
                },
                {
                    // 作者图片上传
                    path: '/uploadHeader',
                    component: () => import(/* webpackChunkName: "upload" */ '../components/page/UploadAuthorHeader.vue'),
                    meta: { title: '作者图片上传' }
                },
                {
                    // 书籍封面上传
                    path: '/uploadCover',
                    component: () => import(/* webpackChunkName: "upload" */ '../components/page/UploadBookCover.vue'),
                    meta: { title: '书籍封面上传' }
                },
                {
                    // vue-schart组件
                    path: '/charts',
                    component: () => import(/* webpackChunkName: "chart" */ '../components/page/BaseCharts.vue'),
                    meta: { title: '信息统计' }
                },
                {
                    // 拖拽列表组件
                    path: '/drag',
                    component: () => import(/* webpackChunkName: "drag" */ '../components/page/DragList.vue'),
                    meta: { title: '拖拽列表' }
                },
                {
                    // 拖拽Dialog组件
                    path: '/dialog',
                    component: () => import(/* webpackChunkName: "dragdialog" */ '../components/page/DragDialog.vue'),
                    meta: { title: '拖拽弹框' }
                },
                {
                    // 国际化组件
                    path: '/i18n',
                    component: () => import(/* webpackChunkName: "i18n" */ '../components/page/I18n.vue'),
                    meta: { title: '国际化' }
                },
                {
                    // 权限页面
                    path: '/permission',
                    component: () => import(/* webpackChunkName: "permission" */ '../components/page/Permission.vue'),
                    meta: { title: '权限测试', permission: true }
                },
                {
                    path: '/404',
                    component: () => import(/* webpackChunkName: "404" */ '../components/page/404.vue'),
                    meta: { title: '404' }
                },
                {
                    path: '/403',
                    component: () => import(/* webpackChunkName: "403" */ '../components/page/403.vue'),
                    meta: { title: '403' }
                }
            ]
        },
        {
            path: '/login',
            component: () => import(/* webpackChunkName: "login" */ '../components/page/Login.vue'),
            meta: { title: '登录' }
        },
        {
            path: '/regist',
            component: () => import(/* webpackChunkName: "login" */ '../components/page/Regist.vue'),
            meta: { title: '注册' }
        }
        // {
        //     path: '*',
        //     redirect: '/404'
        // }
    ]
});
